<template>
  <div class="block">
        <span class="demonstration">完整功能</span>
        <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage1"
      :page-sizes="[20, 40, 60, 80,100]"
      :page-size="20"
      layout="total, sizes, prev, pager, next, jumper"
      :total="this.dataNumber">
        </el-pagination>
  </div>
</template>

<script>
import axios from 'axios'
  export default {
    mounted(){
      this.getdataNumber()
    },
    props:{
        page:{
            default(){
                return 1
            },
        type:Number
        },
        pageSize:{
            default(){
                return 20
            },
        type:Number
        },
        total:{
            default(){
                return 0
            },
        type:Number
        },
        pageSizes:{
            default(){return [20,40,60,80,100]},
            type:Array
        },
    },
    methods: {
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
        this.$emit('changepageSize',val)
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
         this.$emit('changePage',val)
      },
      getdataNumber(){
        axios.get("http://182.61.148.161:3000/user/all").then(res=>{
           this.dataNumber=res.data.length
        })
      }
    },
    data() {
      return {
        currentPage1: 1,
        currentPage2: 5,
        currentPage3: 5,
        currentPage4: 4,
        dataNumber:null,
      };
    }
  }
</script>

<style scoped>
.demonstration{
    color:transparent;
}

</style>